class AddEditsTables < ActiveRecord::Migration
  def self.up
    create_table :edits do |t|
      #Polymorph data
      t.integer :item_id, :null => false
      t.string :item_type, :null => false

      #User who made the edit/request
      t.integer :user_id, :null => false

      #info on the change/request
      t.text :change, :null => false      
      t.text :reason

      #Moderator stuff
      t.text :comment
      t.boolean :approved, :default => false
    end

    add_foreign_key :edits, :users, :column => :user_id
  end

  def self.down
    drop_table :edits
    remove_foreign_key :edits, :column => :user_id
  end
end
